def lucky_num(n, x):
    front = x[0 : n]
    back = x[n : 2 * n]
    if sum(front) % 2 != 0:
        return False

    if front[0] < back[0]:
        for i in range(1, n):
            if front[i] > back[i]:
                return False
        return True

    if front[0] > back[0]:
        for i in range(1, n):
            if front[i] < back[i]:
                return False
        return True

n = int(input())
x = list(map(int, input()))
print('Y' if lucky_num(n, x) else 'N')
